package cn.jiyun.service.impl;

import com.jiyun.common.pojo.product.CarOrder;
import cn.jiyun.mapper.CarOrderMapper;
import cn.jiyun.service.CarOrderService;
import com.jiyun.common.pojo.product.SkuImage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CarOrderServiceImpl implements CarOrderService {

    @Autowired
    private CarOrderMapper carOrderMapper;
    @Override
    public List<CarOrder> findOrderList(Integer sid,String search,Integer state) {
        return carOrderMapper.findOrderList(sid,search,state);
    }

    @Override
    public CarOrder findSkuById(Integer id) {
        // 根据id查询商品信息
        CarOrder carOrder = carOrderMapper.findSkuById(id);
        // 根据商品id查询商品图片列表
        List<SkuImage> skuImages = carOrderMapper.findSkuImageById(carOrder.getId());
        carOrder.setSkuImages(skuImages);
        return carOrder;
    }

    @Override
    public List<CarOrder> findOrder(Integer sid, String search, Integer state) {
        return carOrderMapper.findOrder(sid,search,state);
    }

    @Override
    public List<CarOrder> findAll() {
        return carOrderMapper.findAll();
    }
}
